package com.atguigu.base;

import java.util.concurrent.locks.ReentrantLock;

public class ReentrantLockDemo {
    private final ReentrantLock LO = new ReentrantLock();

    public synchronized void a() {
        this.b();
        System.out.println("a");
    }

    public synchronized void b() {
        System.out.println("b");
    }

    public void c() {
          LO.lock();
          try{

              d();
              System.out.println("c");
          }finally {
              LO.unlock();
          }
    }
    public void d(){
        LO.lock();
        try{
            System.out.println("d");
        }finally {
            LO.unlock();
        }
    }
    public static void main(String[] args) {
        new ReentrantLockDemo().c();
    }
}
